package com.termux.component

import android.content.Context
import com.termux.component.codegen.CodeGenComponent
import com.termux.component.colorscheme.ColorSchemeComponent
import com.termux.component.completion.CompletionComponent
import com.termux.component.config.ConfigureComponent
import com.termux.component.extrakey.ExtraKeyComponent
import com.termux.component.font.FontComponent
import com.termux.component.pm.PackageComponent
import com.termux.component.profile.ProfileComponent
import com.termux.component.session.SessionComponent
import com.termux.component.userscript.UserScriptComponent
import com.termux.frontend.component.ComponentManager
import com.termux.frontend.logging.NLog
import com.termux.frontend.session.shell.ShellProfile

/**
 * @author kiva
 */
object NeoInitializer {
    fun init(context: Context) {
        NLog.init(context)
        initComponents()
    }

    fun initComponents() {
        ComponentManager.registerComponent(ConfigureComponent::class.java)
        ComponentManager.registerComponent(CodeGenComponent::class.java)
        ComponentManager.registerComponent(ColorSchemeComponent::class.java)
        ComponentManager.registerComponent(FontComponent::class.java)
        ComponentManager.registerComponent(UserScriptComponent::class.java)
        ComponentManager.registerComponent(ExtraKeyComponent::class.java)
        ComponentManager.registerComponent(CompletionComponent::class.java)
        ComponentManager.registerComponent(PackageComponent::class.java)
        ComponentManager.registerComponent(SessionComponent::class.java)
        ComponentManager.registerComponent(ProfileComponent::class.java)

        val profileComp = ComponentManager.getComponent<ProfileComponent>()
        profileComp.registerProfile(ShellProfile.PROFILE_META_NAME, ShellProfile::class.java)
    }
}